

monty=5000000

def Atm(name):

    print(f"-----主菜单-----")
    print(f"{name}，您好，欢迎来到黑马银行ATM")
    num=input("请选择你的操作\n"
              "查询余额\t【输入1】\n"
              "存款\t\t【输入2】\n"
              "取款\t\t【输入3】\n"
              "退出\t\t【输入4】\n")

    if str.isdigit(str(num).strip()):
        if int(num)==1:
            query(name)
            Atm(name)
        elif int(num)== 2:
            deposit(name)
            Atm(name)
        elif int(num) == 3:
            withdrawal(name)
            Atm(name)
        elif int(num) == 4:
                print(f"{name}请收好你的卡")
                return
        else:
            print("请按照提示输入数字")
    else:
        print("请输入正确的数字")

def query(name):
    """
    查询余额
    :param name:  户主
    :param monty: 金额
    :return:
    """
    global monty
    print(f"-----查询余额-----")
    print(f"{name}，您好，你的余额剩余{monty}")


def deposit(name):
    """
    存款
    :param name:
    :param monty:
    :return:
    """
    global monty
    print(f"-----存款-----")
    depositMonty = int(input("请输入你要存款的金额/美元"))
    monty+=depositMonty
    print(f"{name}，您好，存款成功你的余额剩余{monty}")

def withdrawal(name):
    """
    取款
    :param name:
    :param monty:
    :return:
    """
    global monty
    print(f"-----取款-----")
    withdrawalMonty = int(input("请输入你要取款的金额/美元"))
    if monty>=withdrawalMonty:
           monty -= withdrawalMonty
           print(f"{name}，您好，取款成功你的余额剩余{monty}")
    else:
            print(f"{name}，您好，对不起取款失败，余额剩余{monty}")


# name="周杰伦"
# Atm(name)


